home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1987 March
/
Ahoy_Magazine_87-03_1987_Double_L.d64
/
Default Prompt
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
1KB
|
49 lines
0 rem << rr39-1 >>
1 rem ----------------------------------
2 print"[147] default prompter "
3 print" rupert report #39 "
4 rem ----------------------------------
5 rem initial alphanumeric key erases
6 rem default value.
7 rem press [del] to backspace.
8 rem press [return] when done.
9 rem
10 prompt$="what filename? "
20 dflt$="file#01"
30 fl$=dflt$ : lf=len(fl$)
40 csr$=chr$(175)+chr$(157)
50 bs$=chr$(20) : cr$=chr$(13)
60 rem =================================
70 print prompt$;dflt$;csr$;
80 gosub 200 :rem get first key
90 if k$=bs$ or k$=cr$ then 120
100 gosub 500 :rem first character
110 gosub 200 :rem get next keystroke
120 if k$=bs$ then gosub 300 : goto 110 : rem handle delete key
130 if k$=cr$ then goto 400 : rem done if return key
140 :rem handle other keys
150 fl$=fl$+k$ : lf=lf+1
160 print k$;csr$;
170 goto 110
180 rem ================================
200 :rem --- get keystroke ---
210 get k$ : if k$="" then 210
220 if k$=cr$ or k$=bs$ then 240
230 if asc(k$)<32 or asc(k$)>127 then 210
240 return
300 :rem --- handle delete key ---
310 if lf>0 then print bs$;csr$;
320 lf=lf-1 : if lf<0 then lf=0
330 fl$=left$(fl$,lf)
340 return
400 :rem --- handle return key ---
410 print " "
420 print"filename is "fl$ : print
430 run
500 :rem --- handle first key ---
510 : rem erase default value
520 for n=1 to lf : print bs$; : next
530 fl$=k$ : lf=1
540 print k$;csr$;
550 return